package cn.sumpu.app.guoguojie.biz;

import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;

import cn.sumpu.app.guoguojie.domain.MemberDetail;
import cn.sumpu.app.guoguojie.domain.Member;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;
import cn.sumpu.app.guoguojie.util.PageModel;
import cn.sumpu.toolkit.weibo.AccessUser;

public interface MemberBiz {
    /**
     * author               Bruce Zhang
     * @param basePath      服务器路径
     * @param member        发给邮件的接受会员
     * @param member        发给邮件的内容
     * @throws AppBusinessException
     */
    public void sendEmailToMember(String basePath, Member member, String title, String emailContent) throws AppBusinessException;

    public void updateMember(Member member) throws AppBusinessException;

    public String approve(String memberId, String status) throws AppBusinessException;//更改用户认证状态

    public String findPassword(HttpServletRequest request) throws AppBusinessException;

    public Member getMemberEmail(String email) throws AppBusinessException;

    public Member getMemberNickname(String nickname) throws AppBusinessException;

    public List<Member> getMemberListByDoorplate(String doorplate) throws AppBusinessException;

    //修改登录用户的信息
    public void updateLoginMember(Member member, MemberDetail detail) throws AppBusinessException;

    //根据昵称nickname取得会员信息
    public Member getMemberByNickname(String nickname) throws AppBusinessException;

    //取得全部的会员昵称和门牌号
    public List<Member> getAllMember(int size) throws AppBusinessException;

    public List<Member> getAllMemberEmail(boolean isActive) throws AppBusinessException;//查询所有会员（激活邮箱）

    public List<Member> getSuperSonList(Map<String, Object> map) throws AppBusinessException;

    public PageModel getPageModel(Member member, Integer page) throws AppBusinessException;

    public PageModel getMemberListByIds(Set<String> idList, Integer page) throws AppBusinessException;

    public PageModel getUserInfoModel(Map<String, Object> map, Integer pageSize, Integer page) throws AppBusinessException;//根据条件筛选用户

    public PageModel getApproveMemberList(String approveStatus, Integer page) throws AppBusinessException;//查询提交认证申请用户

    public PageModel getSuperUserList(Integer page) throws AppBusinessException;//查询超级帐号的小号

    public String cutAvatar(HttpServletRequest request, String srcImg, int xCoords, int yCoords, int destWidth, int destHeight, int divWidth, int divHeight)
                                                                                                                                                            throws AppBusinessException;

    public void sendRegWeibo(Member member, String text, String picUrl) throws AppBusinessException;

    /**
     * 果果街用户登录
     * @author grieous
     * @param account 邮箱或者用户名
     * @param pwd
     * @return 会员信息。如果返回Null，说明登录失败
     * @throws AppBusinessException 登录失败
     */
    public Member login(String account, String pwd, String ip) throws AppBusinessException;

    /**
     * 登录后回调处理(记录用户最后登录时间，登录次数和登录IP)
     * @author grieous
     * @param member
     * @return
     * @throws AppBusinessException
     */
    public Member loginCallback(Member member) throws AppBusinessException;

    /**
     * QQ登录
     * @author grieous
     * @throws AppBusinessException 登录失败
     */
    public String qqLogin(String state) throws AppBusinessException;

    /**
     * QQ登录回调处理
     * @author grieous
     * @throws AppBusinessException 登录失败
     */
    public AccessUser qqLoginCallback(String code, String state) throws AppBusinessException;

    /**
     * 激活会员邮箱
     * @author grieous
     * @param memberId
     * @param activeCode
     * @return
     * @throws AppBusinessException
     * @see cn.sumpu.app.guoguojie.biz.MemberBiz#activeMember(java.lang.String, java.lang.String)
     */
    public Member activeMember(String member, String activeCode) throws AppBusinessException;

    /**
     * 微博授权
     * @author grieous
     * @param oauthVerifier 微博登录返回授权的验证码
     * @return  AccessUser 外部帐号信息
     * @throws AppBusinessException
     */
    public AccessUser oauth(String oauthVerifier, String oauthType) throws AppBusinessException;

    /**
     * 添加关注
     * @author grieous
     * @param member    会员ID
     * @param follow    被关注的会员ID
     * @param each    查询是否互相关注
     * @throws AppBusinessException
     * @see cn.sumpu.app.guoguojie.biz.MemberBiz#cancelFans(java.lang.String, java.lang.String)
     */
    public String addFans(String member, String follow,Integer each) throws AppBusinessException;//添加关注

    /**
     * 取消关注
     * @author grieous
     * @param member    会员ID
     * @param follow    被取消关注的会员ID
     * @throws AppBusinessException
     * @see cn.sumpu.app.guoguojie.biz.MemberBiz#cancelFans(java.lang.String, java.lang.String)
     */
    public void cancelFans(String member, String follow) throws AppBusinessException;//取消关注

    /**
     * 获取会员粉丝数
     * @author grieous
     * @param member
     * @return
     * @throws AppBusinessException
     * @see cn.sumpu.app.guoguojie.biz.MemberBiz#getMemberFansCount(java.lang.String)
     */
    public int getMemberFansCount(String member) throws AppBusinessException;//获取会员拥有的粉丝数

    /**
     * 获取会员关注数
     * @author grieous
     * @param member
     * @return
     * @throws AppBusinessException
     * @see cn.sumpu.app.guoguojie.biz.MemberBiz#getMemberFollowCount(java.lang.String)
     */
    public int getMemberFollowCount(String member) throws AppBusinessException;

    /**
     * 外部帐号登录
     * @author grieous
     * @param accessUser
     * @param request
     * @return
     * @throws AppBusinessException
     */
    public Member outLogin(AccessUser accessUser, HttpServletRequest request) throws AppBusinessException;

    /**
     * 外部帐号登录
     * @author grieous
     * @param accessUser
     * @param request
     * @return Member
     * @throws AppBusinessException
     * @see cn.sumpu.app.guoguojie.biz.MemberBiz#outLogin(cn.sumpu.toolkit.weibo.AccessUser, javax.servlet.http.HttpServletRequest)
     */
    public Member outLogin(String member) throws AppBusinessException;

    /**
     * @author grieous
     * 用户注册.
     * @param member 用户信息
     * @return member
     * @throws AppBusinessException 注册失败
     */
    public Member register(Member member) throws AppBusinessException;

    /**
     * 根据会员ID获取会员信息(不关连其他表)
     * @author grieous
     * @param id
     * @return
     * @throws AppBusinessException
     */
    public Member getMemberById(String id) throws AppBusinessException;

    /**
     * 根据会员ID获取会员信息(包括粉丝数、关注数、外部帐号信息、会员详细信息)
     * @author grieous
     * @param identifier
     * @return
     * @throws AppBusinessException
     */
    public Member getLoginMemberById(String identifier) throws AppBusinessException;

    /**
     * 邮箱帐号登录
     * @author grieous
     * @param email
     * @param pwd
     * @return
     * @throws AppBusinessException
     * @see cn.sumpu.app.guoguojie.biz.MemberBiz#loginByEmail(java.lang.String, java.lang.String)
     */
    public Member loginByEmail(String loginName, String loginPwd) throws AppBusinessException;

    /**
     * 昵称登录
     * @author grieous
     * @param nickname
     * @param pwd
     * @return
     * @throws AppBusinessException
     * @see cn.sumpu.app.guoguojie.biz.MemberBiz#loginByNickname(java.lang.String, java.lang.String)
     */
    public Member loginByNickname(String loginName, String loginPwd) throws AppBusinessException;

    /**
     * 获取会员粉丝集合
     * @author grieous
     * @param member
     * @param page
     * @return
     * @throws AppBusinessException
     * @see cn.sumpu.app.guoguojie.biz.MemberBiz#getMemberFans(java.lang.String, java.lang.Integer)
     */
    public PageModel getMemberFans(String member, Integer page,String ta) throws AppBusinessException;//获取会员拥有的粉丝

    /**
     * 获取会员关注集合
     * @author grieous
     * @param member
     * @param page
     * @return
     * @throws AppBusinessException
     * @see cn.sumpu.app.guoguojie.biz.MemberBiz#getMemberFollows(java.lang.String, java.lang.Integer)
     */
    public PageModel getMemberFollows(String member, Integer page,String ta) throws AppBusinessException;

    public int checkFollow(String member, String ta) throws AppBusinessException;

}
